package mahjong;

import java.io.Serializable;

/** Score class representing the score of a player.
 */
public class Score implements Comparable<Score>, Serializable
{

	/** Name of player who made score*/
	private String name;
	/** numerical value of score*/
	private int score;
	/** Score constructor.
	 * @param n player's name.
	 * @param s player's score.
	 */
	public Score(String n, int s)
	{
		name = n;
		score = s;
	}
	/**
	 * Return the player name
	 * @return name String
	 */
	/** Get the score's owner's name. */
	public String getName() { return name; }
	/**
	 * Return the score value
	 * @return score value int
	 */
	public int getScore() { return score; }

	/**
	 * Score compareTo to sort scores
	 * @param s score to be compared to this
	 * @return 1 if this > s, 0 this == s, -1 this < s
	 */

	@Override
	public int compareTo(Score s) 
	{
		if(s.getScore() < score) return 1;
		if(s.getScore() > score) return -1;
		return 0;
	}
	
}
